home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / ucrasm.zip / SHELL.ASM next >
Assembly Source File  |  1991-12-25  |  2KB  |  92 lines

  1.         include     stdlib.a
  2.         includelib    stdlib.lib
  3.  
  4. ; Global variables go here:
  5.  
  6. dseg        segment    para public 'data'
  7. dseg        ends
  8.  
  9.  
  10.  
  11.  
  12. cseg        segment    para public 'code'
  13.         assume    cs:cseg, ds:dseg
  14.  
  15. lesi        macro    adrs
  16.         mov     di, seg adrs
  17.         mov    es, di
  18.         mov    di, offset adrs
  19.         endm
  20. ;
  21. ldxi        macro    adrs
  22.         mov    dx, seg adrs
  23.         mov    si, offset adrs
  24.         endm
  25. ;
  26. ; Variables that wind up being used by the standard library routines.
  27. ; The MemInit routine uses "PSP" and "zzzzzzseg" labels.  They must be
  28. ; present if you intend to use getenv, MemInit, malloc, and free.
  29. ;
  30. ;
  31.         public    PSP
  32. PSP        dw    ?
  33. ;
  34. cr        equ    13
  35. lf        equ    10
  36. ;
  37. ;
  38. ;--------------------------------------------
  39. ; Here is a good place to put other routines:
  40. ;
  41. ;
  42. ;
  43. ;
  44. ;-----------------------------------------------------------------
  45. ; Main is the main program.  Program execution always begins here.
  46. ;
  47. Main        proc
  48.         mov    cs:PSP, es        ;Save pgm seg prefix
  49.         mov    ax, seg dseg        ;Set up the segment registers
  50.         mov    ds, ax
  51.         mov    es, ax
  52. ;
  53.         mov    dx, 0
  54.         meminit
  55.         jnc    GoodMemInit
  56.  
  57.         print
  58.         db    "Error initializing memory manager",cr,lf,0
  59.         jmp    Quit
  60. GoodMemInit:
  61.  
  62. ;***************************************************************************
  63. ;
  64. ; Put your main program here.
  65. ;
  66. ;***************************************************************************
  67.  
  68.  
  69.  
  70.  
  71.  
  72. Quit:        ExitPgm
  73. Main        endp
  74.  
  75. cseg            ends
  76.  
  77.  
  78.  
  79. ; Allocate a reasonable amount of space for the stack (2k).
  80.  
  81. sseg        segment    para stack 'stack'
  82. stk        db    256 dup ("stack   ")
  83. sseg        ends
  84.  
  85.  
  86. ; zzzzzzseg must be the last segment that gets loaded into memory!
  87.  
  88. zzzzzzseg    segment    para public 'zzzzzz'
  89. LastBytes    db    16 dup (?)
  90. zzzzzzseg    ends
  91.         end    Main
  92.